const hd = {
    permissions: [],
    async init() {
        //获取当前用户的权限
        this.permissions = await axios.get(`admin/permission/currUserPermission`)
    },
    access(name) {
        return this.permissions.some(p => p == name)
    }
}

const install = function (Vue) {
    Vue.prototype.$hd = hd

    Vue.mixin({
        data() {
            return {
                //设置监听，让hd发生改变的时候，页面上可以正常显示
                hd
            }
        }
    })
}

export default install;
